package interficie;

import java.awt.BorderLayout;
import java.awt.Color;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;

public class MostrarCostes extends JFrame {

	private JPanel contentPane;
	public static MostrarCostes frame;
	private JTable table;
	private DefaultTableModel dm;

	/**
	 * Launch the application.
	 */
	public MostrarCostes(int tam) {
		//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 488, 336);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(0, 277, 668, 254);
		scrollPane.setBackground(new Color(0, 102, 204));
		add(scrollPane);
		
		dm = new DefaultTableModel(0,0);
		String header [] = new String[tam];
		
		
		table = new JTable(dm);
		table.setBackground(new Color(153, 204, 255));
		for(int i = 0; i < tam; ++i){
			System.out.println("entro");
			Vector<Object> data = new Vector<Object>();
			for(int j = 0; j < tam; ++j) {
				data.add("k");
			}
			dm.addRow(data);
			header[i] = "Subtarea " + i;
		}
		dm.setColumnIdentifiers(header);
		scrollPane.setViewportView(table);
	}
}
